<template>
	<div>
		<el-form :model="data.info" :inline="true" class="w-full" label-width="160" v-loading="data.mtloading">

			<el-collapse v-model="data.activeName">

				<!-- 主体信息 -->
				<el-collapse-item :name="1" class="info">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold relative text-[#fafafa]">
							{{ $t('machine.configs.subjectInfo') }}</div>
					</template>
					<template #default>
						<div class="w-full flex flex-wrap">

							<div class="w-1/3" v-prmis="'config_lang_getList'">
								<el-form-item :label="$t('machine.configs.langCode') + ':'" prop="lang" class="w-11/12">
									<el-select v-model="data.mList.lang" clearable filterable
										:placeholder="$t('message.pleaseSelect')">
										<el-option v-for="item of data.language" :key="item.l_id"
											:label="item.l_id + ' - ' + item.name + ' - ' + item.lang"
											:value="item.lang" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.currencySymbol') + ':'" prop="currency" class="w-11/12">
									<el-input v-model="data.mList.currency" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.addMachine.pass') + ':'" prop="restore_code"
									class="w-11/12">
									<el-input v-model="data.mList.restore_code" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.speakerVolume') + ':'" prop="volume"
									class="w-11/12">
									<el-input v-model="data.mList.volume"
										:placeholder="$t('machine.configs.volumeValue')" style="width: 100%;" />
								</el-form-item>
							</div>

							<!-- <div class="w-1/3">
								<el-form-item label="未取商品最大值:" prop="recycle_bin" class="w-11/12">
									<el-input v-model="data.mList.recycle_bin" :placeholder="$t('message.pleaseEnter')" style="width: 100%;"/>
								</el-form-item>
							</div>
							 -->
						</div>
					</template>
				</el-collapse-item>

				<!-- 基本信息 -->
				<el-collapse-item :name="2" class="basis">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold relative text-[#fafafa]">{{
							$t('machine.configs.basic') }} </div>
					</template>

					<template #default>
						<div class="w-full flex flex-wrap">

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.inveAlert') + ':'" prop="stock_warning"
									class="w-11/12">
									<el-input v-model="data.info.stock_warning" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.maxNum') + ':'" prop="recycle_bin_capacity"
									class="w-11/12">
									<el-input v-model="data.info.recycle_bin_capacity"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.switch') + ':'" prop="recycle_bin_full_buy"
									class="w-11/12">
									<el-select v-model="data.info.recycle_bin_full_buy"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.goodsBrow') + ':'" prop="show_goods"
									class="w-11/12">
									<el-select v-model="data.info.show_goods" :placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('machine.configs.modeSwitch')" :value="1" />
										<el-option :label="$t('machine.configs.fixedMode')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.viewBrow') + ':'" prop="show_goods_view"
									class="w-11/12">
									<el-select v-model="data.info.show_goods_view"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('machine.configs.listView')" :value="1" />
										<el-option :label="$t('machine.configs.shelfView')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.recommendingGood') + ':'" prop="goods_sort"
									class="w-11/12">
									<el-select v-model="data.info.goods_sort" :placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('machine.configs.listView')" :value="1" />
										<el-option :label="$t('machine.configs.promotionalGood')" :value="2" />
										<el-option :label="$t('machine.configs.gift')" :value="3" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.tel') + ':'" prop="deal_service_phone"
									class="w-11/12">
									<el-input v-model="data.info.deal_service_phone"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.sideCode') + ':'" prop="cabinet_tray_rotation"
									class="w-11/12">
									<el-input v-model="data.info.cabinet_tray_rotation"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>
							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.lightCode') + ':'" prop="cabinet_light"
									class="w-11/12">
									<el-input v-model="data.info.cabinet_light" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.lightEffect') + ':'" prop="light_effect"
									class="w-11/12">
									<el-select v-model="data.info.light_effect"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('machine.configs.aware')" :value="1" />
										<el-option :label="$t('machine.configs.Illuminate')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

						</div>
					</template>

				</el-collapse-item>

				<!-- 购物流程 -->
				<el-collapse-item :name="3" class="buy">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold relative text-[#fafafa]">{{
							$t('machine.configs.shoppPro') }}</div>
					</template>

					<template #default>

						<div class="w-full flex flex-wrap">
							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.proConfig') + ':'" prop="buy_flow"
									class="w-11/12">
									<el-select v-model="data.info.buy_flow" :placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('machine.configs.default')" :value="1" />
										<el-option :label="$t('machine.configs.shopScan')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3" v-if="data.info.buy_flow == 2">
								<el-form-item :label="$t('machine.configs.QRlink') + ':'" prop="qr_code" class="w-11/12">
									<el-input v-model="data.info.qr_code" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3" v-if="data.info.buy_flow == 2">
								<el-form-item :label="$t('machine.configs.QRdesc') + ':'" prop="qr_desc" class="w-11/12">
									<el-input v-model="data.info.qr_desc" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>
						</div>

					</template>

				</el-collapse-item>

				<!-- 交易信息 -->
				<el-collapse-item :name="4" class="transaction">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold text-[#fafafa]">{{
							$t('machine.configs.transaction') }}</div>
					</template>

					<template #default>

						<div class="w-full flex flex-wrap">

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.taxSwitch') + ':'" prop="tax_switch"
									class="w-11/12">
									<el-select v-model="data.info.tax_switch" :placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3" v-if="data.info.tax_switch == 1">
								<el-form-item :label="$t('machine.configs.taxName') + ':'" prop="tax_name"
									class="w-11/12">
									<el-input v-model="data.info.tax_name" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3" v-if="data.info.tax_switch == 1">
								<el-form-item :label="$t('machine.configs.taxRatio') + ':'" prop="tax_rate"
									class="w-11/12">
									<el-input v-model="data.info.tax_rate" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.maxQuantity') + ':'" prop="limit_quantity"
									class="w-11/12">
									<el-input v-model="data.info.limit_quantity"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.maxAmount') + ':'" prop="limit_amount"
									class="w-11/12">
									<el-input v-model="data.info.limit_amount" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.payType') + ':'" prop="pay_type"
									class="w-11/12">
									<el-select v-model="data.pay_type" :placeholder="$t('message.pleaseSelect')"
										multiple clearable>
										<el-option v-for="item of data.payarr" :label="$t(item.label)"
											:value="item.value" />
									</el-select>
								</el-form-item>
							</div>
							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.scannerSwitch') + ':'" prop="backsweeper"
									class="w-11/12">
									<el-select v-model="data.info.backsweeper"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>
						</div>

					</template>

				</el-collapse-item>

				<!-- 高级设置 -->
				<el-collapse-item :name="5" class="senior">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold text-[#fafafa]">
							{{ $t('machine.addMachine.senior') }}</div>
					</template>

					<template #default>

						<div class="w-full flex flex-wrap">

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.fullVideo') + ':'" prop="full_screen_video"
									class="w-11/12">
									<el-select v-model="data.info.full_screen_video"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('machine.configs.loopPlay')" :value="1" />
										<el-option :label="$t('machine.configs.playSwitch')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs. pickScan') + ':'" prop="scan_pick_up"
									class="w-11/12">
									<el-select v-model="data.info.scan_pick_up"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs. emailLang') + ':'" prop="email_lang"
									class="w-11/12">
									<el-select v-model="data.info.email_lang" :placeholder="$t('message.pleaseSelect')">
										<el-option v-for="(item, index) in data.langarr" :key="index" :label="$t(item.label)"
											:value="item.value" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs. cargoChannel') + ':'" prop="buy_channel"
									class="w-11/12">
									<el-select v-model="data.info.buy_channel"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs. prePickup') + ':'" prop="preclaim"
									class="w-11/12">
									<el-select v-model="data.info.preclaim" :placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.randomPickup') + ':'" prop="random_pickup"
									class="w-11/12">
									<el-select v-model="data.info.random_pickup"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.together') + ':'" prop="more_out"
									class="w-11/12">
									<el-select v-model="data.info.more_out" :placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.vip') + ':'" prop="member_login"
									class="w-11/12">
									<el-select v-model="data.info.member_login"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.openVideo') + ':'" prop="door_video"
									class="w-11/12">
									<el-select v-model="data.info.door_video" :placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.face') + ':'" prop="face_identification"
									class="w-11/12">
									<el-select v-model="data.info.face_identification"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.grocerystoreswitch') + ':'" prop="pre_loading"
									class="w-11/12">
									<el-select v-model="data.info.pre_loading"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

						</div>

					</template>

				</el-collapse-item>

				<!-- 优惠信息 -->
				<el-collapse-item :name="6" class="preferential">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold text-[#fafafa]">{{
							$t('machine.configs.discount') }}</div>
					</template>

					<template #default>
						<div class="w-full flex flex-wrap">
							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.getDiscounts') + ':'" prop="discount_show"
									class="w-11/12">
									<el-select v-model="data.info.discount_show"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.activePictures') + ':'" prop="discount_show"
									class="w-11/12">
									<el-select v-model="data.info.discount_pic"
										:placeholder="$t('message.pleaseSelect')" clearable filterable
										style="width: 94%;">
										<el-option v-for="item of data.imgarr" :key="item.res_id"
											:label="item.res_id + '-' + item.title" :value="item.file_path" />
									</el-select>
									<el-icon style="width: 6%;" size="20" @click="urlimg(data.info.discount_pic)">
										<Picture />
									</el-icon>
								</el-form-item>
							</div>
						</div>

					</template>

				</el-collapse-item>

				<!-- 打印凭条 -->
				<el-collapse-item :name="7" class="Printing">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold text-[#fafafa]">
							{{ $t('machine.configs.receipt') }}</div>
					</template>

					<template #default>
						<div class="w-full flex flex-wrap">

							<div class="w-1/3">
								<el-form-item :label="$t('machine.summarize.printer') + ':'" prop="printer_disable"
									class="w-11/12">
									<el-select v-model="data.info.printer_disable"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.disable')" :value="1" />
										<el-option :label="$t('public.enable')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.billTemplate') + ':'" prop="note_model"
									class="w-11/12">
									<el-select v-model="data.info.note_model" :placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('machine.configs.universal')" :value="1" />
										<el-option :label="$t('machine.configs.other')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.electronic') + ':'" prop="receipt"
									class="w-11/12">
									<el-select v-model="data.info.receipt" :placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.displays') + ':'" prop="result_receipt"
									class="w-11/12">
									<el-select v-model="data.info.result_receipt"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('public.open')" :value="1" />
										<el-option :label="$t('public.close')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.printReceipt') + ':'" prop="printer_model"
									class="w-11/12">
									<el-select v-model="data.info.printer_model"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('machine.configs.auto')" :value="1" />
										<el-option :label="$t('machine.configs.manual')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.customText') + ':'" prop="receipt_desc"
									class="w-11/12">
									<el-input v-model="data.info.receipt_desc" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.QRcode') + '1:'" prop="discount_show"
									class="w-11/12">
									<el-select v-model="data.info.receipt_code1"
										:placeholder="$t('message.pleaseSelect')" clearable filterable
										style="width: 94%;">
										<el-option v-for="item of data.imgarr" :key="item.res_id"
											:label="item.res_id + '-' + item.title" :value="item.file_path" />
									</el-select>
									<el-icon style="width: 6%;" size="20" @click="urlimg(data.info.receipt_code1)">
										<Picture />
									</el-icon>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.QRcode') + '2:'" prop="discount_show"
									class="w-11/12">
									<el-select v-model="data.info.receipt_code2"
										:placeholder="$t('message.pleaseSelect')" clearable filterable
										style="width: 94%;">
										<el-option v-for="item of data.imgarr" :key="item.res_id"
											:label="item.res_id + '-' + item.title" :value="item.file_path" />
									</el-select>
									<el-icon style="width: 6%;" size="20" @click="urlimg(data.info.receipt_code2)">
										<Picture />
									</el-icon>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.QRcode') + '3:'" prop="discount_show"
									class="w-11/12">
									<el-select v-model="data.info.receipt_code3"
										:placeholder="$t('message.pleaseSelect')" clearable filterable
										style="width: 94%;">
										<el-option v-for="item of data.imgarr" :key="item.res_id"
											:label="item.res_id + '-' + item.title" :value="item.file_path" />
									</el-select>
									<el-icon style="width: 6%;" size="20" @click="urlimg(data.info.receipt_code3)">
										<Picture />
									</el-icon>
								</el-form-item>
							</div>

						</div>
					</template>

				</el-collapse-item>

				<!-- 交易结果 -->
				<el-collapse-item :name="8" class="delive">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold text-[#fafafa]">{{
							$t('machine.configs.results') }}</div>
					</template>

					<template #default>
						<div class="w-full flex flex-wrap">

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.mainTitle') + ':'" prop="deal_success_title"
									class="w-11/12">
									<el-input v-model="data.info.deal_success_title"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.failedTitle') + ':'" prop="deal_fail_title"
									class="w-11/12">
									<el-input v-model="data.info.deal_fail_title"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.tel') + ':'" prop="service_tel_show"
									class="w-11/12">
									<el-select v-model="data.info.service_tel_show"
										:placeholder="$t('message.pleaseSelect')">
										<el-option :label="$t('machine.configs.display')" :value="1" />
										<el-option :label="$t('machine.configs.hide')" :value="2" />
									</el-select>
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.succesSubtitle') + ':'"
									prop="deal_success_sub_title" class="w-11/12">
									<el-input v-model="data.info.deal_success_sub_title"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.failedSubtitle') + ':'"
									prop="deal_fail_sub_title" class="w-11/12">
									<el-input v-model="data.info.deal_fail_sub_title"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.errorPic') + ':'" prop="deal_abnormal_pic"
									class="w-11/12">
									<el-select v-model="data.info.deal_abnormal_pic"
										:placeholder="$t('message.pleaseSelect')" clearable filterable
										style="width: 94%;">
										<el-option v-for="item of data.imgarr" :key="item.res_id"
											:label="item.res_id + '-' + item.title" :value="item.file_path" />
									</el-select>
									<el-icon style="width: 6%;" size="20" @click="urlimg(data.info.deal_abnormal_pic)">
										<Picture />
									</el-icon>
								</el-form-item>
							</div>

						</div>
					</template>

				</el-collapse-item>

				<!-- 取货出货 -->
				<el-collapse-item :name="9" class="Take">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold text-[#fafafa]">{{ $t('machine.configs.pick')
							}}</div>
					</template>

					<template #default>
						<div class="w-full flex flex-wrap">

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.pickuPage') + ':'" prop="claim_goods_title"
									class="w-11/12">
									<el-input v-model="data.info.claim_goods_title"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.shipment') + ':'" prop="out_goods_title"
									class="w-11/12">
									<el-input v-model="data.info.out_goods_title"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

						</div>
					</template>

				</el-collapse-item>

				<!-- 机器配置 -->
				<el-collapse-item :name="10" class="machine">
					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold text-[#fafafa]">{{
							$t('machine.configs.machine') }}</div>
					</template>

					<template #default>
						<div class="w-full flex flex-wrap">

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.homeTimeout') + ':'" prop="terminal_timeout"
									class="w-11/12">
									<el-input v-model="data.info.terminal_timeout"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>

							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.adTimeout ') + ':'" prop="adv_timeout"
									class="w-11/12">
									<el-input v-model="data.info.adv_timeout" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>
							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.purchaseTab ') + ':'" prop="buy_normal_tab"
									class="w-11/12">
									<el-input v-model="data.info.buy_normal_tab"
										:placeholder="$t('message.pleaseEnter')" style="width: 100%;" />
								</el-form-item>
							</div>
							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.fixedTab ') + ':'" prop="buy_fix_tab"
									class="w-11/12">
									<el-input v-model="data.info.buy_fix_tab" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>
							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.hotelTag') + ':'" prop="buy_hotel_tab"
									class="w-11/12">
									<el-input v-model="data.info.buy_hotel_tab" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>
							<div class="w-1/3">
								<el-form-item :label="$t('machine.configs.sortTag') + ':'" prop="buy_hotel_tab"
									class="w-11/12">
									<el-input v-model="data.info.buy_hotel_tab" :placeholder="$t('message.pleaseEnter')"
										style="width: 100%;" />
								</el-form-item>
							</div>
						</div>
					</template>

				</el-collapse-item>

				<!-- 设备帮助 -->
				<el-collapse-item :name="11" class="help">

					<template #title>
						<div class="h-8 text-base pl-4 mt-2 font-semibold text-[#fafafa]">设备帮助</div>
					</template>

					<template #default>
						<div v-for="(item, key) in data.help_list" class="relative bg-slate-50 m-2">

							<div class="w-full flex flex-wrap pt-4">
								<div class="w-1/3">
									<el-form-item :label="$t('machine.helps.helpTitle') + ':'" prop="deal_service_phone"
										class="w-11/12">
										<el-input v-model="item.title" :placeholder="$t('message.pleaseEnter')"
											style="width: 100%;" />
									</el-form-item>
								</div>

								<div class="w-1/3">
									<el-form-item :label="$t('machine.helps.displayHelp') + ':'" prop="show_goods"
										class="w-11/12">
										<el-switch v-model="item.show" :active-value="1" :inactive-value="2" />
									</el-form-item>
								</div>

								<div class="w-1/3" v-prmis="'config_lang_getList'">
									<el-form-item :label="$t('machine.configs.langCode') + ':'" prop="deal_service_phone"
										class="w-11/12">
										<el-select v-model="item.lang" clearable filterable
											:placeholder="$t('message.pleaseSelect')">
											<el-option v-for="item of data.language" :key="item.l_id"
												:label="item.l_id + ' - ' + item.name + ' - ' + item.lang"
												:value="item.lang" />
										</el-select>
									</el-form-item>
								</div>
							</div>

							<div class="w-full flex flex-wrap p-4">
								<div class="w-6/12 text-[red] pl-8 text-sm">
									{{ $t('machine.configs.Note') }}
								</div>
								<div class="w-6/12 text-right">
									<el-button type="primary" size="large" @click="addhelp(key)">{{
										$t('public.newAdd')}}</el-button>
									<el-button v-if="key != 0" type="danger" size="large" @click="delhelp(key)">{{
										$t('public.del')}}</el-button>
								</div>

							</div>

							<div class="w-full p-4 pt-0">
								<el-form-item :label="$t('machine.helps.content')+':'" prop="show_goods" class="w-full">
									<Editor v-model="item.content" />
								</el-form-item>
							</div>

						</div>
					</template>

				</el-collapse-item>

			</el-collapse>

			<div class="w-full text-center mt-6">
				<div class="inline-block">
					<el-button type="primary" @click="submit" v-prmis="'machine_group_mg_getList'">{{
						$t('public.save') }}</el-button>
					<el-button @click="cancell">{{ $t('public.cancel') }}</el-button>
				</div>
			</div>

		</el-form>

		<el-dialog v-model="data.demonstrate" :title="$t('machine.addMachine.material')" center width="30%">
			<div class="flex justify-center">
				<el-image class="max-w-80" :src="data.file_path" fit="fill" />
			</div>
		</el-dialog>

	</div>
</template>

<script lang="ts" setup>
import { useI18n } from 'vue-i18n'
const { t: $t } = useI18n()
import { getlang } from '@/api/manage';
import { getresourceList } from '@/api/advment';
import Editor from '@/components/Editor/index.vue';
import getPlevel from '@/utils/level';
let emit = defineEmits(['submit'])

let data = reactive({
	mtloading: false, // 加载状态
	demonstrate: false, // 素材演示
	activeName: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
	imgarr: [], // 图片素材
	pay_type: [], // 选中的支付类型
	langarr: [], // 语言列表
	language: [], // 原始语言
	payarr: [], // 支付类型
	file_path: '', // 素材链接
	original: '', // 保存原始数据，防止污染
	help_list: [], // 设备帮助
	mList: { // 主体信息
		lang: '',
		currency: '',
		restore_code: '',
		volume: '',
		// recycle_bin:'',
	},
	info: {
		buy_flow: 1, // 购物流程配置
		qr_code: '', // 二维码链接
		qr_desc: '', // 二维码说明
		tax_switch: 2, // 税费开关
		tax_name: '', // 税费名称
		tax_rate: '', // 税率比例
		limit_quantity: $t('machine.configs.unlimited'), // 最多购买量
		limit_amount: $t('machine.configs.unlimited'), // 最高购买金额
		pay_type: '', // 支付类型
		unionpay_terminal_number: '',
		scan_pick_up: 2, // 扫码提货
		email_lang: 'zh-cn', // 邮件语言
		buy_channel: 2, // 购买指定货道
		preclaim: 2, // 预取货
		random_pickup: 2, // 随机取货
		more_out: 1, // 多件同出
		member_login: 1, // 会员信息
		door_video: 2, // 开关门录像
		face_identification: 2, // 人脸识别
		pre_loading: 2, // 预上货开关
		printer_disable: 1, // 打印机
		note_model: 1, // 票据模板
		printer_model: 1, // 结果页打印凭条
		receipt: 2, // 电子小票
		receipt_code1: '', // 二维码1
		receipt_code2: '', // 二维码2
		receipt_code3: '', // 二维码3
		receipt_desc: '', // 自定义文字
		result_receipt: 2, // 结果页显示小票
		deal_success_title: $t('machine.llocation.defaultSuccestitle'), // 交易成功主标题
		deal_success_sub_title: $t('machine.llocation.defaultSuccess'), // 交易成功副标题
		deal_abnormal_pic: '', // 交易异常页图片 
		deal_fail_title: $t('machine.llocation.defaultFailtitle'), // 交易失败主标题
		deal_fail_sub_title: $t('machine.llocation.defaultCustome'), // 交易失败副标题
		deal_service_phone: '', // 客服电话
		terminal_timeout: '30', // 首页超时时长
		adv_timeout: '60', // 广告超时时间
		volume: '', // 扬声器音量
		show_goods: 1, // 商品浏览模式
		show_goods_view: 1, // 默认浏览视图
		goods_sort: 1, // 优先商品排序
		cabinet_tray_rotation: '', // 边柜托盘
		cabinet_light: '',
		light_effect: 1, // 灯光效果
		claim_goods_title: $t('machine.llocation.defaultClaim'), // 取货页文案
		out_goods_title: $t('machine.llocation.defaultOut'), // 出货页文案
		discount_show: '', // 获取优惠
		discount_pic: '', // 活动图片
		stock_warning: '0', // 库存预警
		recycle_bin_full_buy: 1, // 购买开关
		recycle_bin_capacity: $t('machine.configs.unlimited'), // 未取商品最大值
		expire_notice: '',
		full_screen_video: 1, // 全屏视频
		service_tel_show: 1, // 客服电话
		backsweeper: 2,
		buy_normal_tab: '',
		buy_fix_tab: '',
		buy_hotel_tab: '',
	}
})

// 加载
let getloding = (e) => {
	data.mtloading = e
	if (e == false) {
		cancell()
	}
}

// 增加设备帮助
let addhelp = (e) => {
	let obj = {
		title: '',
		content: '',
		lang: '',
		show: 1,
	}
	data.help_list.push(obj)
}

// 删除设备帮助
let delhelp = (k) => {
	data.help_list.splice(k, 1)
}

// 保存按钮
let submit = () => {
	let obj = {}
	for (let key in data.info) {
		if (data.info[key] != '') {
			obj[key] = data.info[key]
		}
	}

	let help_list = []

	for (let item of data.help_list) {
		if (item.title != '' && item.content != '' && item.lang != '') {
			help_list.push(item)
		}
	}

	let mList = {}
	for (let key in data.mList) {
		if (data.mList[key] != '') {
			mList[key] = data.mList[key]
		}
	}
	obj.recycle_bin_capacity = obj.recycle_bin_capacity == $t('machine.configs.unlimited') ? 0 : obj.recycle_bin_capacity
	obj.limit_quantity = obj.limit_quantity == $t('machine.configs.unlimited') ? 0 : obj.limit_quantity
	obj.pay_type = data.pay_type.join(',')
	emit('submit', obj, help_list, mList)
}

// 取消按钮
let cancell = () => {
	for (let key in data.info) {
		data.info[key] = ''
	}
}


// 邮件语言
let getemaillang = (e) => {
	let name = '--'

	for (let item of data.langarr) {
		if (e == item.value) {
			name = item.label
		}
	}

	return name
}

// 查看素材
let urlimg = (e) => {
	if (e == '') {
		return;
	}
	data.demonstrate = true;
	data.file_path = e;
}

// 获取信息
let getadvlist = () => {
	data.imgarr = []
	data.payarr = []
	// 素材列表
	getresourceList({ type: 1 }).then(res => {
		if (res.state == 200) {
			for (let item of res.data) {
				if (item.status == 1) {
					data.imgarr.push(item)
				}
			}
		}
	})

	// 支付类型
	let pay = getPlevel.getPpay('', 1)
	for (let i = 1; i < pay.length; i++) {
		data.payarr.push(pay[i])
	}

	// 获取语言列表
	getlang().then(res => {
		if (res.state == 200) {
			data.language = res.data
			for (let item of res.data) {
				data.langarr.push({
					label: item.name + ' - ' + item.lang,
					value: item.lang
				})
			}
		}
	})

	data.help_list = [{ // 帮助信息主体
		title: '',
		content: '',
		lang: '',
		show: 1,
	}]

}

getadvlist()

// 暴露方法，给父组件调用
defineExpose({
	getloding
});

</script>
<style type="text/css">
.info .el-collapse-item__header {
	background: rgba(75, 141, 284, 0.8);
}

.info .el-collapse-item__wrap {
	border: 1px solid rgba(75, 141, 284, 0.4);
}

.basis .el-collapse-item__header {
	background: rgba(79, 166, 196, 0.8);
	margin-top: 20px;
}

.basis .el-collapse-item__wrap {
	border: 1px solid rgba(79, 166, 196, 0.4);
}

.buy .el-collapse-item__header {
	background: rgba(255, 97, 3, 0.8);
	margin-top: 20px;
}

.buy .el-collapse-item__wrap {
	border: 1px solid rgba(255, 97, 3, 0.4);
}

.transaction .el-collapse-item__header {
	background: rgba(133, 191, 79, 0.8);
	margin-top: 20px;
}

.transaction .el-collapse-item__wrap {
	border: 1px solid rgba(133, 191, 79, 0.4);
}

.senior .el-collapse-item__header {
	background: rgba(299, 100, 121, 0.8);
	margin-top: 20px;
}

.senior .el-collapse-item__wrap {
	border: 1px solid rgba(299, 100, 121, 0.4);
}

.preferential .el-collapse-item__header {
	background: rgba(197, 92, 193, 0.8);
	margin-top: 20px;
}

.preferential .el-collapse-item__wrap {
	border: 1px solid rgba(197, 92, 193, 0.4);
}

.Printing .el-collapse-item__header {
	background: rgba(224, 144, 63, 0.8);
	margin-top: 20px;
}

.Printing .el-collapse-item__wrap {
	border: 1px solid rgba(224, 144, 63, 0.4);
}

.delive .el-collapse-item__header {
	background: rgba(122, 70, 60, 0.8);
	margin-top: 20px;
}

.delive .el-collapse-item__wrap {
	border: 1px solid rgba(122, 70, 60, 0.4);
}

.Take .el-collapse-item__header {
	background: rgba(83, 83, 83, 0.8);
	margin-top: 20px;
}

.Take .el-collapse-item__wrap {
	border: 1px solid rgba(83, 83, 83, 0.4);
}

.machine .el-collapse-item__header {
	background: rgba(186, 174, 160, 0.8);
	margin-top: 20px;
}

.machine .el-collapse-item__wrap {
	border: 1px solid rgba(186, 174, 160, 0.4);
}

.help .el-collapse-item__header {
	background: rgba(181, 180, 186, 0.8);
	margin-top: 20px;
}

.help .el-collapse-item__wrap {
	border: 1px solid rgba(181, 180, 186, 0.4);
}

.el-collapse-item__content {
	padding-top: 20px;
	padding-bottom: 0;
}

.el-collapse-item__arrow {
	color: #fafafa;
}
</style>